package com.itdfq.consumer.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;



/**
 * @Author GocChin
 * @Date 2021/7/19 16:43
 * @Blog: itdfq.com
 * @QQ: 909256107
 * @Description:
 */
@RestController
@Slf4j
public class ConsumerController {
    @Autowired
    private RestTemplate restTemplate;

    /**
     * 老方法调用 ，没有使用 Eureka ，restTemplate 没有使用 @LoadBalanced 注解
     * @return
     */
    @GetMapping("/article/callHello")
    public String callHello() {
        log.info("运行了方法一");
        return restTemplate.getForObject("http://localhost:8081/test", String.class);
    }
    @GetMapping("/article/callHello2")
    public String callHello2() {
        log.info("运行了方法二");
        return restTemplate.getForObject("http://eureka-client-user-service/test", String.class);
    }



}
